{% extends "layouts" ~ DIR ~ "default.twig" %}

{% block content %}

{% if months is not empty %}
{# Months? (For yearly archives) #}
<div class="archive standalone">
{% for when, month in months %}
<h2 id="label_{{ when }}_archive" class="archive">
<a href="{{ url('archive/%s/' | format(when | dateformat('Y/m'))) }}">
{{ when | time("F Y" | translate, "title") }}
</a>
</h2>
<ul aria-labelledby="label_{{ when }}_archive" class="archive">
{% for post in month %}
<li>
<article class="post archive {{ post.feather }}" id="post_{{ post.id }}" role="presentation">
<section class="post_archive_container" aria-hidden="true">
{% if post.image is defined %}
{{ post.image | thumbnail("", false, ["max_width=196", "quality=60", "square=1"], "196px") }}
{% else %}
{% if post.title is not empty %}
<h3 class="archive">{{ post.title | striptags | normalize | truncate(20) }}</h3>
{% endif %}
<p>{{ post.excerpt() | striptags | normalize | truncate(1000) | oneof(post.slug) }}</p>
{% endif %}
</section>
<a href="{{ post.url() }}" class="archive_post_link">
{{ "Permanent link to &#8220;%s&#8221;" | translate | format(post.title() | oneof(post.slug) | striptags | normalize | fix(true)) }}
</a>
</article>
</li>
{% endfor %}
</ul>
{% endfor %}
</div>
{% if archive.next is not empty %}
<div role="navigation" class="next traversal">
<a href="{{ url('archive/%s/' | format(archive.next | dateformat('Y'))) }}">
{{ archive.next | time("Y") }}
</a>
</div>
{% endif %}
{% elseif posts.paginated is not empty %}
{# Posts? (For daily/monthly archives) #}
<div class="filter">
{{ "Archive of %s" | translate | format(archive.when | time(archive.depth == "day" ? "d F Y" : "F Y")) }}
</div>
{% for post in posts.paginated %}
{% include(["feathers" ~ DIR ~ post.feather ~ ".twig", "feathers" ~ DIR ~ "missing.twig"]) %}
{% endfor %}
{% else %}
{# No results #}
<div role="status" class="filter">{{ "There aren't any posts in the timeframe you specified." | translate }}</div>
{% endif %}

{% endblock %}
